﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Threading;

namespace Cineman
{
    public partial class SettingsPage : PhoneApplicationPage
    {
        public SettingsPage()
        {
            InitializeComponent();
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            Settings.LoadSettings();
            if (Settings.LiveTileOn == "true") 
            {
                LiveTileToggle.IsChecked = true;
            }
            else
            {
                LiveTileToggle.IsChecked = false;
            }
            DisplayLanguageList.SelectedIndex = Convert.ToInt32(Settings.DisplayLanguage);

        }

        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (LiveTileToggle.IsChecked.Value == true)
            {
                Settings.LiveTileOn = "true";
            }
            else
            {
                Settings.LiveTileOn = "false";
            }
            Settings.DisplayLanguage = Convert.ToString(DisplayLanguageList.SelectedIndex);
            Settings.SaveSettings();
        }




    }
}